import './player.css';
import { selectGameState } from '../gameSlice';
import { useSelector } from 'react-redux';

/**
 * @function Player 玩家提示栏hook
 * @returns Player hook
 */
function Player () {
    const { ending, endingTar, currentPlayer } = useSelector(selectGameState);
    return (<div className="player">
        {ending ? `Winner: ${endingTar}` : (`Next player:${currentPlayer ? 'X' : 'O'}`)}
    </div>);
}

export default Player;
